package com.diaohaiwen.basic.websockt.obj.bo;

import com.alibaba.fastjson.JSONObject;
import com.diaohaiwen.basic.websockt.obj.vo.FileVo;
import com.diaohaiwen.common.util.NumberUtil;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * @author 刁海文
 * @since 2023/12/7 22:22
 */
@Data
@Accessors(chain = true)
public class FileBo {

    public String contentType;

    public long length;

    private String folder;

    private String filename;

    private String original;

    private String md5;

    @Override
    public String toString() {
        return JSONObject.toJSONString(this);
    }

    public FileVo toVo() {
        return FileVo.builder().name(original).size(NumberUtil.formatSize(length)).build();
    }
}
